﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RepeaterTests.aspx.cs" Inherits="OpenWaves.Web.Tests.RepeaterTests" %>
<%@ Import Namespace="OpenWaves.Web.Controls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>    
        <h2>Empty data source</h2>
        <ow:Repeater runat="server" DataSource="<%#Enumerable.Empty<int>()%>">
            <NoResultsTemplate>
                No results
            </NoResultsTemplate>
        </ow:Repeater>
    </div>
    
    <div>
        <h2>Repeater template</h2>
        <ow:Repeater ID="Repeater1" runat="server" DataSource="<%#Enumerable.Range(1, 5)%>">
            <Template>
                Items:
                <%#((IEnumerable<int>) Repeater1.DataSource).Count()%>
                <ul>
                    <ow:ItemsPlaceHolder runat="server" />
                </ul>
            </Template>
            <ItemTemplate>
                <li><%#Container.DataItem %></li>
            </ItemTemplate>
        </ow:Repeater>
    </div>
    
    <div>
        <h2>Alternating rows</h2>
        <ow:Repeater runat="server" DataSource="<%#new List<int> {1, 2, 3, 4, 5}%>">
            <Template>
                <ul><ow:ItemsPlaceHolder runat="server"/></ul>
            </Template>
            <ItemTemplate>
                <%#Container.Cycle("odd ", "even ") + Container.DataItem %>
            </ItemTemplate>
        </ow:Repeater>
    </div>    
    
    <div>
        <h2>First item template with separator template</h2>
        <ow:Repeater runat="server" DataSource="<%#new List<int> {1, 2, 3, 4, 5}%>">
            <FirstItemTemplate>
                First <%#Container.DataItem %>
            </FirstItemTemplate>
            <ItemTemplate>
                <%#Container.DataItem %>
            </ItemTemplate>
            <SeparatorTemplate>
                ,
            </SeparatorTemplate>
        </ow:Repeater>
    </div>    


    <div>
        <h2>Groups with first item and separators</h2>
        <ow:Repeater runat="server" DataSource="<%#new List<int> {1, 2, 3, 4, 5}%>" GroupSize="2">
            <FirstItemTemplate>
                First <%#Container.DataItem %>
            </FirstItemTemplate>
            <ItemTemplate>
                <%#Container.Cycle("odd ", "even ") + Container.DataItem %>
            </ItemTemplate>
            <SeparatorTemplate>
                ,
            </SeparatorTemplate>
	        <GroupTemplate>
		        <span style="border: 1px solid red"><ow:ItemsPlaceHolder runat="server" /></span>
	        </GroupTemplate>
        </ow:Repeater>
    </div>    
    
    </form>
</body>
</html>
